<template>
  <a-card :bordered="false">

    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="标题">
              <a-input placeholder="请输入标题" v-model="queryParam.name"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
            </span>
          </a-col>

        </a-row>
      </a-form>
    </div>

    <!-- 操作按钮区域 -->
    <div class="table-operator">
      <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
      <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
    </div>


    <!-- table区域-begin -->
    <div>
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        class="j-table-force-nowrap"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        @change="handleTableChange">

        <span slot="action" slot-scope="text, record">
          <a @click="query(record)">详情</a>
        </span>

      </a-table>
    </div>
    <!-- table区域-end -->

  </a-card>
</template>

<script>
import JInput from '@/components/jeecg/JInput'
import JTreeDict from '@/components/jeecg/JTreeDict'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'

export default {
  name: 'ProcessICreated',
  mixins: [JeecgListMixin],
  components: {
    // SysUserAgentModal,
    // UserModal,
    // PasswordModal,
    JInput,
    JTreeDict
  },
  data() {
    return {
      form: this.$form.createForm(this),
      editorValue: '',
      columns: [
        {
          title: '序号',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: 'center',
          customRender: function(t, r, index) {
            return parseInt(index) + 1
          }
        },
        {
          title: '流程编码',
          dataIndex: 'processInstanceId',
          align: 'center'
        },
        {
          title: '标题',
          dataIndex: 'name',
          align: 'center'
        },
        {
          title: '发起人',
          dataIndex: 'initiator_dictText',
          align: 'center'
        }
        ,
        {
          title: '发起时间',
          dataIndex: 'initiationTime',
          align: 'center'
        }
        ,
        {
          title: '结束时间',
          dataIndex: 'completeTime',
          align: 'center'
        },
        {
          title: '状态',
          dataIndex: 'resultDesc',
          align: 'center',
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          scopedSlots: { customRender: 'action' }
        }
      ],
      url: {
        list: '/procFormResult/processCreateOfMine'
        // list: '/formModel/list',
        // delete: '/oa/oaTemplate/delete',
        // deleteBatch: '/oa/oaTemplate/deleteBatch',
        // exportXlsUrl: 'oa/oaTemplate/exportXls',
        // importExcelUrl: 'oa/oaTemplate/importExcel'
      }

    }
  },
  methods: {
    query(row) {
      console.log(row, 'ROW')
      this.$router.push({
        path: '/applyFormDetails',
        query: {
          processInstanceId: row.processInstanceId,
          taskId: row.taskId,
          revokeShowFlag: true,
          title:row.title,
          processResult: row.result
        }
      })
    },
  }
}
</script>